package feeinterface.protocol.req;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.util.HashMap;
import java.util.Map;

import com.ulwx.tool.ByteUtils;
import com.ulwx.tool.ObjectUtils;
import com.ulwx.tool.RequestUtils;

import feeinterface.protocol.res.Res010002;
import feeinterface.protocol.res.Res010003;
import feeinterface.protocol.res.Res010004;
import feeinterface.protocol.res.Res010005;
import feeinterface.protocol.res.Res010006;
import feeinterface.protocol.res.Res010009;
import feeinterface.protocol.utils.Translate;


public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {

		test010002();
//		test010003();
//		test010004();
//		test010005();
//		test010006();
//		test010009();
	}
	private static void test010002(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	
		requestParameters.put("Protocol", new String[]{"010002"});
		requestParameters.put("FeeID", new String[]{"1"});
		requestParameters.put("PacketID", new String[]{"1"});
		requestParameters.put("FeeType", new String[]{"1"});
		requestParameters.put("Ver", new String[]{"1"});
		requestParameters.put("VmVer", new String[]{"1"});
		requestParameters.put("Platform", new String[]{"17"});
		requestParameters.put("SmsCenter", new String[]{"+8613800200500"});
		requestParameters.put("IMSI", new String[]{"1"});
		requestParameters.put("COID", new String[]{"1"});
		requestParameters.put("ChannelID", new String[]{"1"});
		requestParameters.put("DestAddr", new String[]{"1"});
		requestParameters.put("Content", new String[]{"1"});
		
		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010002 obj=(Res010002)Translate.translateObjectFromStream(Res010002.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static void test010003(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	

		requestParameters.put("Protocol", new String[]{"010003"});
		requestParameters.put("FeeID", new String[]{"1"});
		requestParameters.put("FeeType", new String[]{"1"});
		requestParameters.put("ChannelID", new String[]{"1"});
		requestParameters.put("PacketID", new String[]{"1"});
		requestParameters.put("Ver", new String[]{"1"});
		requestParameters.put("COID", new String[]{"1"});
		requestParameters.put("Platform", new String[]{"17"});
		requestParameters.put("SmsCenter", new String[]{"+8613800200500"});
		requestParameters.put("IMSI", new String[]{"1"});
		requestParameters.put("VmVer", new String[]{"1"});
		requestParameters.put("AccessStep", new String[]{"1"});
		requestParameters.put("WapContent", new String[]{"1"});
		
		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010003 obj=(Res010003)Translate.translateObjectFromStream(Res010003.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static void test010004(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	

		requestParameters.put("Protocol", new String[]{"010004"});
		requestParameters.put("FeeID", new String[]{"1"});
		requestParameters.put("ChannelID", new String[]{"1"});
		requestParameters.put("FeeType", new String[]{"1"});
		requestParameters.put("Ver", new String[]{"1"});
		requestParameters.put("PacketID", new String[]{"1"});
		requestParameters.put("VmVer", new String[]{"1"});
		requestParameters.put("Platform", new String[]{"17"});
		requestParameters.put("SmsCenter", new String[]{"+8613800200500"});
		requestParameters.put("IMSI", new String[]{"1"});
		requestParameters.put("COID", new String[]{"1"});
		requestParameters.put("packet", new String[]{"1"});
		
		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010004 obj=(Res010004)Translate.translateObjectFromStream(Res010004.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static void test010005(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	

		requestParameters.put("Protocol", new String[]{"010005"});
		requestParameters.put("PacketID", new String[]{"1"});
		requestParameters.put("IMSI", new String[]{"4602420122044"});
		requestParameters.put("Ver", new String[]{"1"});
		requestParameters.put("Platform", new String[]{"1"});
		requestParameters.put("SmsCenter", new String[]{"+8613800200500"});
		requestParameters.put("VmVer", new String[]{"1"});
		requestParameters.put("COID", new String[]{"1"});
		
		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010005 obj=(Res010005)Translate.translateObjectFromStream(Res010005.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static void test010006(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	

		requestParameters.put("Protocol", new String[]{"010006"});
		requestParameters.put("IMSI", new String[]{"4602420122044"});
		requestParameters.put("ExtVar", new String[]{"1"});
		requestParameters.put("ThirdPartyUrlID", new String[]{"1"});
		requestParameters.put("Mobile", new String[]{"+8613800200500"});

		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010006 obj=(Res010006)Translate.translateObjectFromStream(Res010006.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static void test010009(){
		Map<String, String[]> requestParameters = new HashMap<String, String[]>();	

		requestParameters.put("Protocol", new String[]{"010009"});
		requestParameters.put("COID", new String[]{"111"});
		requestParameters.put("IMSI", new String[]{"4602420122044"});
		requestParameters.put("ver", new String[]{"1"});
		requestParameters.put("IsUpdate", new String[]{"1"});
		requestParameters.put("SmsCenter", new String[]{"+8613800200500"});
		requestParameters.put("VmVer", new String[]{"1"});
		requestParameters.put("Platform", new String[]{"17"});
		
		RequestUtils ru = new RequestUtils(requestParameters);
		byte[] bs = Exchange.gen(ru);
		String result=ByteUtils.format(bs);
		System.out.println(result);
		try {
			ByteArrayInputStream in=new ByteArrayInputStream(bs);
			DataInputStream id=new DataInputStream(in);
			Res010009 obj=(Res010009)Translate.translateObjectFromStream(Res010009.class, id);
			System.out.println(ObjectUtils.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
